package com.hsc.yalebao.tabChongZhi;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.handmark.pulltorefresh.library.ILoadingLayout;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.hsc.yalebao.adapter.XianXiaJiLuListViewAdapter;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.model.XianXiaResultBean;
import com.hsc.yalebao.model.XianXiaResultBean.ResultBean;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import okhttp3.Call;

public class XianxiaTijiaoJiluActivity extends BaseActivity
{
  public static final String TAG = "ZoushituActivity";
  private XianXiaJiLuListViewAdapter adapter;
  Context context;
  private View emptyView;
  private boolean isEnd = false;
  private ImageView iv_title_right;
  private ArrayList<XianXiaResultBean.ResultBean> list;
  private PullToRefreshListView lv;
  int memberid;
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      default:
        return;
      case 2131099699:
      }
      CustomApplication.app.finishActivity(XianxiaTijiaoJiluActivity.this);
    }
  };
  private int page = 1;
  private TextView tv_tishi;

  private void getResultList(final boolean paramBoolean)
  {
    HashMap localHashMap = new HashMap();
    localHashMap.put("memberid", this.memberid);
    localHashMap.put("page", this.page);
    localHashMap.put("pagesize", "10");
    localHashMap.put("paymentid", "-1");
    localHashMap.put("status", "-1");
    LogUtils.d("ZoushituActivity", "URL:" + AppConstants.URL_GET_GETTRANSRECORDLIST);
    RequestNet.get(this.context, AppConstants.URL_GET_GETTRANSRECORDLIST, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        XianxiaTijiaoJiluActivity.this.lv.onRefreshComplete();
        LogUtils.e("ZoushituActivity", "获取失败,getResultList-result:" + paramAnonymousException);
        XianxiaTijiaoJiluActivity.this.lv.setEmptyView(XianxiaTijiaoJiluActivity.this.emptyView);
        XianxiaTijiaoJiluActivity.this.tv_tishi.setText("获取失败");
      }

      public void onResponse(String paramAnonymousString)
      {
        XianxiaTijiaoJiluActivity.this.lv.onRefreshComplete();
        if ((paramAnonymousString == null) || ("".equals(paramAnonymousString)))
        {
          LogUtils.e("ZoushituActivity", "result:" + paramAnonymousString);
          XianxiaTijiaoJiluActivity.this.tv_tishi.setText("获取失败");
        }
        XianXiaResultBean localXianXiaResultBean;
        do
        {
          return;
          Gson localGson = new Gson();
          try
          {
            localXianXiaResultBean = (XianXiaResultBean)localGson.fromJson(paramAnonymousString, XianXiaResultBean.class);
            if (localXianXiaResultBean == null)
            {
              LogUtils.e("ZoushituActivity", "getResultList-Bean == null，获取失败");
              XianxiaTijiaoJiluActivity.this.tv_tishi.setText("获取失败");
              return;
            }
          }
          catch (Exception localException)
          {
            while (true)
            {
              localException.printStackTrace();
              localXianXiaResultBean = null;
            }
            System.out.println("获取flag=" + localXianXiaResultBean.flag);
            if (localXianXiaResultBean.flag == 0)
            {
              XianxiaTijiaoJiluActivity.this.tv_tishi.setText("获取失败");
              return;
            }
            if (localXianXiaResultBean.flag == -4)
            {
              XianxiaTijiaoJiluActivity.activityStack.backToMain(MainActivity.class, XianxiaTijiaoJiluActivity.this.context);
              return;
            }
            if (localXianXiaResultBean.flag == -2)
            {
              XianxiaTijiaoJiluActivity.this.showDownWireDialog();
              return;
            }
            if (localXianXiaResultBean.flag == -3)
            {
              XianxiaTijiaoJiluActivity.this.ShowFengjinDialog();
              return;
            }
          }
        }
        while (localXianXiaResultBean.flag != 1);
        if (localXianXiaResultBean.result == null)
        {
          System.out.println("服务器返回数据错误=" + localXianXiaResultBean.result + "=null");
          return;
        }
        if (paramBoolean)
          if ((XianxiaTijiaoJiluActivity.this.list != null) && (localXianXiaResultBean.result.size() > 0))
          {
            System.out.println("加载更多数据:" + localXianXiaResultBean.result.size() + "条");
            XianxiaTijiaoJiluActivity.this.list.addAll(localXianXiaResultBean.result);
            if (localXianXiaResultBean.result.size() >= 10)
              break label441;
            XianxiaTijiaoJiluActivity.this.isEnd = true;
          }
        while (true)
        {
          if (XianxiaTijiaoJiluActivity.this.list.size() == 0)
            XianxiaTijiaoJiluActivity.this.tv_tishi.setText("暂无记录");
          if (XianxiaTijiaoJiluActivity.this.adapter == null)
            break;
          XianxiaTijiaoJiluActivity.this.adapter.setData(XianxiaTijiaoJiluActivity.this.list);
          XianxiaTijiaoJiluActivity.this.adapter.notifyDataSetChanged();
          System.out.println("更新数据");
          return;
          label441: XianxiaTijiaoJiluActivity.this.isEnd = false;
          continue;
          XianxiaTijiaoJiluActivity.this.list = localXianXiaResultBean.result;
        }
        XianxiaTijiaoJiluActivity.this.adapter = new XianXiaJiLuListViewAdapter(XianxiaTijiaoJiluActivity.this.context, XianxiaTijiaoJiluActivity.this.list);
        XianxiaTijiaoJiluActivity.this.lv.setAdapter(XianxiaTijiaoJiluActivity.this.adapter);
        System.out.println("第一次设置数据");
      }
    });
  }

  private void initData()
  {
    this.list = new ArrayList();
    getResultList(false);
  }

  private void initRefresh()
  {
    this.lv.setMode(PullToRefreshBase.Mode.BOTH);
    this.lv.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener()
    {
      public void onRefresh(PullToRefreshBase<ListView> paramAnonymousPullToRefreshBase)
      {
        String str = DateUtils.formatDateTime(XianxiaTijiaoJiluActivity.this.getApplicationContext(), System.currentTimeMillis(), 524305);
        paramAnonymousPullToRefreshBase.getLoadingLayoutProxy().setLastUpdatedLabel(str);
        if (XianxiaTijiaoJiluActivity.this.lv.isHeaderShown())
        {
          LogUtils.e("ZoushituActivity", "mPullRefreshListView刷新");
          XianxiaTijiaoJiluActivity.this.refeshList();
          return;
        }
        LogUtils.e("ZoushituActivity", "mPullRefreshListView加载");
        if (XianxiaTijiaoJiluActivity.this.isEnd)
          UiUtil.showToast(XianxiaTijiaoJiluActivity.this.context, "暂无更多数据");
        XianxiaTijiaoJiluActivity localXianxiaTijiaoJiluActivity = XianxiaTijiaoJiluActivity.this;
        localXianxiaTijiaoJiluActivity.page = (1 + localXianxiaTijiaoJiluActivity.page);
        XianxiaTijiaoJiluActivity.this.getMoreList();
      }
    });
  }

  private void initView()
  {
    this.lv = ((PullToRefreshListView)findViewById(2131100002));
    this.emptyView = LayoutInflater.from(this.context).inflate(2130903139, null);
    this.tv_tishi = ((TextView)this.emptyView.findViewById(2131100053));
    this.tv_tishi.setText("获取中...");
    this.lv.setEmptyView(this.emptyView);
    setTitle(8, 0, 2130837809, "查看转账记录", 0, 8, 8, 0, true);
    initRefresh();
  }

  protected void getMoreList()
  {
    getResultList(true);
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903094);
    this.context = this;
    if (CustomApplication.app.userBaseBean != null)
      this.memberid = CustomApplication.app.userBaseBean.getMemberid();
    initView();
    initData();
  }

  protected void refeshList()
  {
    this.page = 1;
    getResultList(false);
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    View localView = findViewById(2131099716);
    if (paramBoolean)
      localView.setVisibility(0);
    while (true)
    {
      ((TextView)localView.findViewById(2131099701)).setText(paramString);
      ((TextView)localView.findViewById(2131099700)).setVisibility(paramInt1);
      ImageView localImageView = (ImageView)localView.findViewById(2131099699);
      localImageView.setVisibility(paramInt2);
      localImageView.setOnClickListener(this.onClickListener);
      localImageView.setImageResource(paramInt3);
      TextView localTextView = (TextView)localView.findViewById(2131099702);
      localTextView.setVisibility(paramInt5);
      localTextView.setOnClickListener(this.onClickListener);
      ((ImageView)localView.findViewById(2131099703)).setVisibility(8);
      this.iv_title_right = ((ImageView)localView.findViewById(2131099704));
      this.iv_title_right.setVisibility(paramInt6);
      this.iv_title_right.setOnClickListener(this.onClickListener);
      this.iv_title_right.setImageResource(paramInt7);
      return;
      localView.setVisibility(8);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabChongZhi.XianxiaTijiaoJiluActivity
 * JD-Core Version:    0.6.2
 */